package com.heima.comment.controller.v1;

import com.heima.comment.service.CommentRepayService;
import com.heima.model.comment.dtos.*;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "评论回复行为api", value = "评论回复行为api")
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {
    @Autowired
    private CommentRepayService commentRepayService;

    @ApiOperation(value = "保存评论回复信息", notes = "保存评论回复信息")
    @PostMapping("/save")
    public ResponseResult saveComment(@RequestBody CommentRepaySaveDTO dto) {
        return commentRepayService.saveCommentRepay(dto);
    }

    @ApiOperation(value = "查询评论回复信息", notes = "查询评论回复信息")
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayDTO dto) {
        return commentRepayService.loadCommentRepay(dto);
    }


    @ApiOperation(value = "保存评论回复点赞", notes = "保存评论回复点赞")
    @PostMapping("/like")
    public ResponseResult like(@RequestBody CommentRepayLikeDTO dto) {
        return commentRepayService.saveCommentRepayLike(dto);
    }

}
